Repository navigation
feat(llmrec): opt-in LLM context size telemetry and aggregation (P3.5 phase A) - #426
Merged
Merged
Conversation
… C worker/planner analysis
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Opt-in, size-only telemetry for the assembled LLM request, so Phases B (bounded context) and C (cache prefix) can be evaluated against data instead of guesses. Default off; no prompt, compaction or model behavior changes.
llmrec:ARTEX_CONTEXT_TELEMETRY=1measures the assembledCompletionRequestonStreamandComplete: system bytes split atDynamicBoundary(matching normajoinSystemtrim/drop-empty/\n\nsemantics), serialized tool-schema bytes and count, message bytes by role,tool_resultsubset and last-message bytes. No content is stored.db: migration0009_llm_context.sqladdsllm_context;ComputeLLMContextSharesattributes each call's realinput_tokensto sections pro rata by bytes;LLMContextSummaryreturns per-(worker, model) p50/p90/p99/max input, cache-read ratio and top tasks.server: authenticatedGET /api/llm/context/summary?days=30&top=20&task=...(no UI in Phase A).docs/context-telemetry.md: semantics, SQL, retention guidance, and a representative fixture report with the real built-in volatility per lane (worker per-intent suffix, planner constraints, custom-prompt{{.Now}}only).Verification
go test -p 1 -count=1 ./llmrec ./db ./serverwith Postgres: green.joinSystemfor padded/empty segments; flag off writes zero rows; no content sentinel reaches the table; migration 0009 applies on a pre-0009 database.e10c2b7.